﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(Renderer))]
public class LX_AddDistort : MonoBehaviour
{
    private Renderer _renderer;
    private Material _material;
    private LX_DistortManager _DistortManager;

    void Start()
    {
        _renderer = this.GetComponent<Renderer>();
        _material = _renderer.sharedMaterial;
        _DistortManager = LX_DistortManager.GetInstance;
        _DistortManager.AddRenderer(_renderer, _material);
        _renderer.enabled = false;

    }

    private void OnEnable()
    {
        if (_DistortManager)
            _DistortManager.AddRenderer(_renderer, _material);
    }

    private void OnDisable()
    {
        if (_DistortManager)
            _DistortManager.RemoveRenderer(_renderer);
    }

}